<!DOCTYPE html>
<!--suppress ALL-->
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>下载信息管理</title>
    <link rel="stylesheet" type="text/css" href="/static/jquery-easyui-1.7.0/themes/metro-blue/easyui.css">
    <link rel="stylesheet" type="text/css" href="/static/jquery-easyui-1.7.0/themes/icon.css">
    <script type="text/javascript" src="/static/jquery-easyui-1.7.0/jquery.min.js"></script>
    <script type="text/javascript" src="/static/jquery-easyui-1.7.0/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/static/jquery-easyui-1.7.0/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript">
        var url;

        function searchDownloadMessage() {
            $("#dg").datagrid('load', {
                "userId": $("#s_userId").combogrid("getValue")
            });
        }

        function resetValue() {
            $("#s_userId").combogrid("setValue", "");
        }

        function deleteDownloadMessage() {
            var selectedRows = $("#dg").datagrid("getSelections");
            if (selectedRows.length == 0) {
                $.messager.alert("系统提示", "请选择要删除的数据！");
                return;
            }
            var strIds = [];
            for (var i = 0; i < selectedRows.length; i++) {
                strIds.push(selectedRows[i].id);
            }
            var ids = strIds.join(",");
            $.messager.confirm("系统提示", "您确定要删除这<span style='color: red'>" + selectedRows.length + "</span>条数据吗?", function (r) {
                if (r) {
                    $.post("/admin/downloadMessage/delete", {ids: ids}, function (result) {
                        if (result.success) {
                            $.messager.alert("系统提示", "数据已成功删除！");
                            $("#dg").datagrid("reload");
                        } else {
                            $.messager.alert("系统提示", result.errorInfo);
                        }
                    }, "json");
                }
            });
        }

        function formatUser(val,row) {
            return val.userName;
        }
    </script>
</head>
<body style="margin: 1px">
<table id="dg" title="下载信息管理" class="easyui-datagrid" striped="true"
       fitColumns="true" pagination="true" rownumbers="true"
       url="/admin/downloadMessage/list" fit="true" toolbar="#tb">
    <thead>
    <th field="cb" checkbox="true" align="center"></th>
    <th field="id" width="20" align="center" hidden="hidden">编号</th>
    <th field="user" width="10" align="center" formatter="formatUser">用户名</th>
    <th field="downloadDate" width="14" align="center">下载时间</th>
    <th field="message" width="50" align="center">内容</th>
    </thead>
</table>

<div id="tb">
    <div>
        <a href="javascript:deleteDownloadMessage()" class="easyui-linkbutton" iconCls="icon-remove" plain="true">删除</a>
    </div>
    <div>
        &nbsp;用户名：&nbsp;
        <select id="s_userId" name="userId" class="easyui-combogrid" style="width:140px" data-options="
			panelWidth: 800,
			idField: 'id',
			textField: 'userName',
			url: '/admin/user/comboList',
			method: 'get',
			columns: [[
				{field:'id',title:'编号',width:40},
				{field:'userName',title:'用户名',width:60},
				{field:'nickName',title:'昵称',width:60,align:'right'},
				{field:'roleName',title:'身份',width:60,align:'right'},
				{field:'email',title:'邮箱',width:100},
			]],
			fitColumns: true
		">
        </select>
        <a href="javascript:searchDownloadMessage()" class="easyui-linkbutton" iconCls="icon-search" plain="true">搜索</a>
        <a href="javascript:resetValue()" class="easyui-linkbutton" iconCls="icon-reset" plain="true">重置</a>
    </div>
</div>
</body>
</html>